<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
			<view class="" style="padding-top: 30rpx;">
				<view class="item-con flex-col justify-between" v-for="(item, index) in dataList" :key="index">
					<view class="flex-row items-center justify-between">
						<text class="item-title">{{item.name}}</text>
						<view> <text class="item-o-m" v-if="">{{item.io==0?'+':'-'}}</text><text class="item-o-m">{{item.money}}</text></view>
					</view>
					<view class="item-time">消费时间：{{item.createDate}}</view>
				</view>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
export default {
	data() {
		return {
			dataList: []
		};
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid: uni.getStorageSync('uid'),
				pageNo: pullScroll.page,
				pageSize: '10'
			};
			if (pullScroll.page == 1) this.dataList = [];
			const res = await this.$request('user/commission-detail', data, { showLoading: true });
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.item-con {
	width: 708rpx;
	height: 162rpx;
	background: #ffffff;
	border-radius: 20rpx;
	padding: 30rpx;
	margin: 0 auto 20rpx;
}
.item-o-m {
	font-size: 34rpx;
	font-weight: bold;
	color: #fe5d5d;
}
.item-o-s{
	font-size: 34rpx;
	font-weight: bold;
	color:#429EFE;
}
.item-title {
	font-size: 34rpx;
	font-weight: bold;
	color: #333333;
}
.item-time {
	font-size: 24rpx;
	font-weight: 500;
	color: #999999;
	line-height: 31rpx;
}
</style>
